<?php

require_once('Interface.php');
require_once(ISLANDS_PATH . '/Smarty/libs/Smarty.class.php');

class CodeIslands_TemplateEngine_Smarty implements CodeIslands_TemplateEngine_Interface
{
	private $_smarty = null;
	
	public function __construct($filters=null)
	{
		$this->_smarty = new Smarty();
		$this->_smarty->compile_dir = ISLANDS_PATH . '/templates_c';
		$this->_smarty->plugins_dir = ISLANDS_PATH . '/sysplugins';
		$this->_smarty->autoload_filters = $filters;
	}
	
	public function fetch($template_data, $template_filename)
	{
		$this->_smarty->assign('data', $template_data);
		return $this->_smarty->fetch($template_filename);
	}
}